package top.go2do.goods.business.goods.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import top.go2do.goods.business.goods.module.GoodsTagPO;

import java.util.List;
import java.util.Set;

/**
 * @Description
 * @Author xingyj
 * @CreateTime 2025/3/17 10:21
 */
public interface GoodsTagRepository extends JpaRepository<GoodsTagPO, Long>, JpaSpecificationExecutor<GoodsTagPO> {
    List<GoodsTagPO> findByGoodsIdIn(Set<Long> goodsIdSet);


    @Transactional
    @Modifying
    @Query("DELETE FROM GoodsTagPO gt WHERE gt.goodsId = ?1") // 根据email删除
    int deleteByGoodsId(Long goodsId);
}
